<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

use Cache;
use App\Models\FarmCombination;

class FarmCombinationController extends Controller
{

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $parent_id = $request->input('parent_id');
        $com       = $request->input('com');
        foreach ($com as $v) {
            $m = new FarmCombination;
            $m->parent_id = $parent_id;
            $m->son_id    = $v['id'];
            $m->number    = $v['num'];
            $m->save();
        }
    }
}
